home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / aviplay / aviplay.frm < prev    next >
Text File  |  1995-05-08  |  2KB  |  56 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "AVI Play"
  4.    ClientHeight    =   825
  5.    ClientLeft      =   3810
  6.    ClientTop       =   1785
  7.    ClientWidth     =   2175
  8.    Height          =   1230
  9.    Icon            =   AVIPLAY.FRX:0000
  10.    Left            =   3750
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   825
  14.    ScaleWidth      =   2175
  15.    Top             =   1440
  16.    Visible         =   0   'False
  17.    Width           =   2295
  18. End
  19. Declare Function mciSendString Lib "MMSystem" (ByVal lpstrCommand As String, ByVal lpstrReturn As String, ByVal nSize As Integer, ByVal hCallback As Integer) As Long
  20. Declare Function mciGetErrorString Lib "MMSystem" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal wLength As Integer) As Integer
  21.  
  22. Sub Form_Load ()
  23.     fname$ = Command$
  24.     If Len(fname$) < 1 Then End
  25.     caption = "Playing"
  26.     i = playit(fname$)
  27.     End
  28. End Sub
  29.  
  30. Function playit (fname$)
  31. Dim res1 As String
  32. res1 = SendMciCommand$("open " + fname$ + " alias video9 wait")
  33. res1 = SendMciCommand$("play video9 wait")
  34. res1 = SendMciCommand$("close video9")
  35. End Function
  36.  
  37. Function SendMciCommand$ (cmd As String)
  38.     Dim result As String
  39.     Dim status As Integer
  40.     Dim i As Integer
  41.  
  42.     result = String$(256, 0)
  43.     caption = "Send It"
  44.     status = mciSendString(cmd, result, Len(result), 0)
  45.     If (status <> 0) Then
  46.         status = mciGetErrorString(status, result, Len(result))
  47.     End If
  48.     i = InStr(result, Chr$(0))
  49.     If i <> 0 Then
  50.         SendMciCommand$ = Left$(result, i - 1)
  51.     Else
  52.         SendMciCommand$ = result
  53.     End If
  54. End Function
  55.  
  56.